package boot.demo.event;


import com.google.common.eventbus.Subscribe;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

@Component
public class SimpleEventListener {
    private final static Logger LOGGER = LoggerFactory.getLogger(SimpleEventListener.class);

    @Subscribe
    public void doAction(EventB eventb ) throws InterruptedException {
        LOGGER.info("SimpleEventListener 接收到事件01。先睡一会{}", eventb.getMsg());
        Thread.sleep(3000);
        LOGGER.info("SimpleEventListener 接收到事件01{}，执行", eventb.getMsg());
    }

    @Subscribe
    public void doAction2(EventB eventb ) throws InterruptedException {
        LOGGER.info("SimpleEventListener 接收到事件02。先睡一会{}", eventb.getMsg());
        Thread.sleep(3000);
        LOGGER.info("SimpleEventListener 接收到事件02 {}， 执行", eventb.getMsg());
    }
}
